import { IPSApplication } from './app/ipsapplication';
import { ModelServiceStore } from './core';
import { IPSAppDataEntity, IPSAppView } from './exports';
import { IPSModelObject } from './ipsmodel-object';

/**
 * 模型基础服务对象
 * @export
 * @interface IPSModelService
 */
export interface IPSModelService {
  // 全局缓存
  readonly store: ModelServiceStore;
  // 应用模型实例
  readonly app: IPSApplication;

  /**
   * 获取应用对象
   *
   * @return {*}  {IPSApplication}
   */
  getPSApplication(): IPSApplication;

  /**
   *
   *
   * @param {IModel} obj
   * @return {*}  {IModel}
   */
  getRealObjectNode(obj: IModel): IModel;

  // /**
  //  * 转化原始数据对象
  //  *
  //  * @param {IPSModelObject} relatedPSModelObject
  //  * @param {*} objectNode
  //  * @return {*}  {*}
  //  */
  // getRealModel(relatedPSModelObject: IPSModelObject, objectNode: any): any;

  /**
   * 从模型文件加载对象
   *
   * @param {IPSModelObject} relatedPSModelObject
   * @param {string} filePath
   * @return {*}  {*}
   */
  getModel(relatedPSModelObject: IPSModelObject, filePath: string): any;

  /**
   * 从指定模型中获取指定对象
   *
   * @param {IPSModelObject} relatedPSModelObject
   * @param {string} cls
   * @param {*} objNode
   * @param {string} strTag
   * @return {*}  {*}
   */
  getPSModel4(
    relatedPSModelObject: IPSModelObject,
    cls: string,
    objNode: any,
    strTag: string,
  ): any;

  /**
   * 从模型数组中获取指定对象
   *
   * @param {IPSModelObject} relatedPSModelObject
   * @param {string} cls
   * @param {any[]} list
   * @param {*} objKey
   * @return {*}  {*}
   */
  getPSModel5(
    relatedPSModelObject: IPSModelObject,
    cls: string,
    list: any[],
    objKey: any,
  ): any;

  /**
   *
   *
   * @param {*} relatedPSModelObject
   * @param {string} cls
   * @param {IModel} obj
   * @return {*}  {IPSModelObject}
   */
  getChildPSModelObject(
    relatedPSModelObject: any,
    cls: string,
    obj: IModel,
  ): IPSModelObject;

  /**
   *
   *
   * @param {*} relatedPSModelObject
   * @param {string} cls
   * @return {*}  {IPSModelObject}
   */
  getParentPSModelObject(
    relatedPSModelObject: any,
    cls: string,
  ): IPSModelObject;

  /**
   * 获取应用视图
   *
   * @param {string} strPath
   * @return {*}  {IPSAppView}
   */
  getPSAppView(obj: IModel): Promise<IPSAppView>;
  getPSAppView(strPath: string): Promise<IPSAppView>;

  /**
   * 获取应用实体
   *
   * @param {string} strPath
   * @return {*}  {Promise<IPSAppDataEntity>}
   */
  getPSAppDataEntity(obj: IModel): Promise<IPSAppDataEntity>;
  getPSAppDataEntity(strPath: string): Promise<IPSAppDataEntity>;

  /**
   * 获取代码表
   *
   * @author chitanda
   * @date 2021-04-12 11:04:37
   * @param {string} strPath
   * @return {*}  {IPSModelObject}
   */
  getPSAppCodeList(strPath: string): IPSModelObject;

  /**
   * 获取应用功能
   *
   * @author chitanda
   * @date 2021-04-12 10:04:41
   * @param {string} tag
   * @return {*}  {IPSModelObject}
   */
  getPSAppFunc(tag: string): IPSModelObject;

  /**
   * 获取界面行为
   *
   * @author chitanda
   * @date 2021-04-12 10:04:47
   * @param {string} tag
   * @return {*}  {IPSModelObject}
   */
  getPSUIAction(tag: string): IPSModelObject;

  /**
   * 根据视图标识获取视图模型路径
   *
   * @param {string} tag 实体 + 视图 全小写
   * @return {*}  {string}
   */
  getPSAppViewPath(tag: string): string;

  /**
   * 获取语言资源
   *
   * @author chitanda
   * @date 2021-05-28 09:05:27
   * @param {string} key
   * @return {*}  {string}
   */
  getPSLang(key: string): string;
}
